import { createApp } from 'vue'
import HelloWorld from '../Windows/HelloWorld.vue'
import { CSS3DObject } from 'three/examples/jsm/Addons.js'
import * as THREE from 'three'

export function createHelloWorld3DObject(position: THREE.Vector3, rotation?: THREE.Euler) {
  const container = document.createElement('div')
  createApp(HelloWorld).mount(container)

  const object = new CSS3DObject(container)
  object.position.copy(position)

  if (rotation) {
    object.rotation.copy(rotation)
  }

  return object
}